var ClubSettingWindow_Old = Window.extend({
    _ccsFileName: res.ClubSettingWindow_Old_json,
    _clubId: null,
    initWindow: function (clubId) {
        this._clubId = clubId;
        var clubInfo = ClubDataManager.getClubData(clubId);
        this._nodeList['word_tcjlb'].setVisible(clubInfo['owner_uid'] != gameData.uid);
        this._nodeList['btn_jiesan'].setVisible(clubInfo['owner_uid'] == gameData.uid);
        this._nodeList['btn_jiesan'].setVisible(clubInfo['owner_uid'] == gameData.uid);
        this._nodeList['word_zywf'].setVisible(false);

        var isAdmin = ClubDataManager.isSelfAdministration(clubId, gameData.uid);
        //this._nodeList['btn_disBandStting'].setVisible(isAdmin);
        //this._nodeList['btn_tableSetting'].setVisible(isAdmin);
        //this._nodeList['frams_2'].setVisible(isAdmin);
        //this._nodeList['Text_8'].setVisible(isAdmin);
    },

    _initClickListeners: function () {
        this._clickListeners = {
            'btn_gonggao': '_changeNotice',
            'btn_updateName': '_changeName',
            'btn_yingye': '_clickYingye',
            'btn_jiesan': '_clickJieSan',
            'word_tcjlb': '_clickTuiChu',
            'word_zywf': '_clickBlendWafna',
            'btn_tableSetting': '_clickTableSetting',
            'btn_disBandStting': '_clickDisBandSetting',
        };
    },

    _changeNotice: function () {
        showWindow('ClubChangeNoticeWindow', this._clubId);
    },

    _changeName: function () {
        if (ClubDataManager.isSelfAdministration(this._clubId, gameData.uid)) {
            showWindow('ClubChangeNameWindow', this._clubId);
        } else {
            showAlert('只有群主与管理员才可以修改亲友圈名称');
        }
    },

    _clickYingye: function () {
        var data = ClubDataManager.getClubData(this._clubId);
        if (gameData.uid == data['owner_uid']) {
            this.addChild(new ClubShowTimeLayer(ClubDataManager.getClubData(this._clubId)));
        } else {
            if (ClubDataManager.getClubIsShutDown(this._clubId)) {//打烊状态
                this.addChild(new ClubDayangLayer(this._clubId));
            } else {//开放状态
                this.addChild(new ClubDayangLayer(this._clubId));
            }
        }
    },

    _clickJieSan: function () {
        var self = this;
        showMessageBox('确定解散该亲友圈？', function () {
            network.send(2103, {cmd: ClubMsgCode.DeleteClub, club_id: self._clubId});
            self.close();
        });
    },

    _clickTuiChu: function () {
        var self = this;
        showMessageBox('确定退出该亲友圈', function () {
            var name = gameData.nickname;
            name = name.replace('%', '').replace('\'', '').replace('"', '').replace('\\', '');
            network.send(2103, {
                cmd: ClubMsgCode.LeaveClub,
                club_id: self._clubId,
                uid: gameData.uid,
                name: name,
                head: gameData.headimgurl
            });
            self.close();
        });
    },

    _clickBlendWafna: function () {
        showWindow('ClubBlendWanfaSettingWindow', this._clubId,ClubBlendWanfaSettingWindow_Type_Blend);
    },

    _clickTableSetting: function () {
        showWindow('ClubBlendWanfaSettingWindow', this._clubId,ClubBlendWanfaSettingWindow_Type_TableSetting);
    },

    _clickDisBandSetting: function () {
        showWindow('ClubDisbandSettingWindow', this._clubId);
    },
});